# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>

pkgbase=pygobject
pkgname=(python-gobject)
pkgver=3.44.1
pkgrel=3
pkgdesc="Python Bindings for GLib/GObject/GIO/GTK+"
url="https://wiki.gnome.org/Projects/PyGObject"
arch=(x86_64)
license=(LGPL)
depends=(
  gobject-introspection-runtime
  python
)
makedepends=(
  git
  gobject-introspection
  meson
  python-cairo
)
checkdepends=(
  gtk3
  python-pytest
  xorg-server-xvfb
)
optdepends=('cairo: Cairo bindings')
provides=("pygobject-devel=$pkgver")
conflicts=(pygobject-devel)
replaces=('pygobject-devel<=3.36.1-1')
_commit=1a2544c898ca2aafcab0c9e472be22657f310cf3  # tags/3.44.1^0
source=(
  "git+https://gitlab.gnome.org/GNOME/pygobject.git#commit=$_commit"
)
b2sums=('SKIP')

pkgver() {
  cd pygobject
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd pygobject
}

build() {
  arch-meson pygobject build
  meson compile -C build
}

check() {
  PYTEST_ADDOPTS="-v" PYGI_TEST_VERBOSE=1 \
    xvfb-run -s '-nolisten local' \
    meson test -C build --print-errorlogs
}

package_python-gobject() {
  meson install -C build --destdir "$pkgdir"
  python -m compileall -d /usr/lib "$pkgdir/usr/lib"
  python -O -m compileall -d /usr/lib "$pkgdir/usr/lib"
}

# vim:set sw=2 sts=-1 et:
